home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Source / GNU / cc / gcc.info-6 (.txt) < prev    next >
GNU Info File  |  1993-10-21  |  51KB  |  930 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: PA Install,  Next: Sun Install,  Prev: Cross-Compiler,  Up: Installation
  23. Installing on the HP Precision Architecture
  24. ===========================================
  25.    There are two variants of this CPU, called 1.0 and 1.1, which have
  26. different machine descriptions.  You must use the right one for your
  27. machine.  All 7NN machines and 8N7 machines use 1.1, while all other
  28. 8NN machines use 1.0.
  29.    The easiest way to handle this problem is to use `configure hpNNN'
  30. or `configure hpNNN-hpux', where NNN is the model number of the
  31. machine.  Then `configure' will figure out if the machine is a 1.0 or
  32. 1.1.  Use `uname -a' to find out the model number of your machine.
  33.    `-g' does not work on HP-UX, since that system uses a peculiar
  34. debugging format which GNU CC does not know about.  There are
  35. preliminary versions of GAS and GDB for the HP-PA which do work with
  36. GNU CC for debugging.  You can get them by anonymous ftp from
  37. `jaguar.cs.utah.edu' `dist' subdirectory.  You would need to install
  38. GAS in the file
  39.      /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  40. where CONFIGURATION is the configuration name (perhaps `hpNNN-hpux')
  41. and GCCVERSION is the GNU CC version number.  Do this *before* starting
  42. the build process, otherwise you will get errors from the HPUX
  43. assembler while building `libgcc2.a'.  The command
  44.      make install-dir
  45. will create the necessary directory hierarchy so you can install GAS
  46. before building GCC.
  47.    If you obtained GAS before October 6, 1992 it is highly recommended
  48. you get a new one to avoid several bugs which have been discovered
  49. recently.
  50.    To enable debugging, configure GNU CC with the `--gas' option before
  51. building.
  52.    It has been reported that GNU CC produces invalid assembly code for
  53. 1.1 machines running HP-UX 8.02 when using the HP assembler.  Typically
  54. the errors look like this:
  55.      as: bug.s @line#15 [err#1060]
  56.        Argument 0 or 2 in FARG upper
  57.               - lookahead = ARGW1=FR,RTNVAL=GR
  58.      as: foo.s @line#28 [err#1060]
  59.        Argument 0 or 2 in FARG upper
  60.               - lookahead = ARGW1=FR
  61.    You can check the version of HP-UX you are running by executing the
  62. command `uname -r'.   If you are indeed running HP-UX 8.02 on a 1.1
  63. machine and using the HP assembler then configure GCC with
  64. "hp700-hpux8.02".
  65. File: gcc.info,  Node: Sun Install,  Next: 3b1 Install,  Prev: PA Install,  Up: Installation
  66. Installing GNU CC on the Sun
  67. ============================
  68.    On Solaris (version 2.1), do not use the linker or other tools in
  69. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  70.    Make sure the environment variable `FLOAT_OPTION' is not set when
  71. you compile `libgcc.a'.  If this option were set to `f68881' when
  72. `libgcc.a' is compiled, the resulting code would demand to be linked
  73. with a special startup file and would not link properly without special
  74. pains.
  75.    The GNU compiler does not really support the Super SPARC processor
  76. that is used in SPARC Station 10 and similar class machines.  You can
  77. get code that runs by specifying `sparc' as the cpu type; however, its
  78. performance is not very good, and may vary widely according to the
  79. compiler version and optimization options used.  This is because the
  80. instruction scheduling parameters designed for the Sparc are not correct
  81. for the Super SPARC.  Implementing scheduling parameters for the Super
  82. SPARC might be a good project for someone who is willing to learn a
  83. great deal about instruction scheduling in GNU CC.
  84.    There is a bug in `alloca' in certain versions of the Sun library.
  85. To avoid this bug, install the binaries of GNU CC that were compiled by
  86. GNU CC.  They use `alloca' as a built-in function and never the one in
  87. the library.
  88.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  89. problem is a segmentation fault in cpp.  This problem seems to be due to
  90. the bulk of data in the environment variables.  You may be able to avoid
  91. it by using the following command to compile GNU CC with Sun CC:
  92.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  93. File: gcc.info,  Node: 3b1 Install,  Next: Unos Install,  Prev: Sun Install,  Up: Installation
  94. Installing GNU CC on the 3b1
  95. ============================
  96.    Installing GNU CC on the 3b1 is difficult if you do not already have
  97. GNU CC running, due to bugs in the installed C compiler.  However, the
  98. following procedure might work.  We are unable to test it.
  99.   1. Comment out the `#include "config.h"' line on line 37 of `cccp.c'
  100.      and do `make cpp'.  This makes a preliminary version of GNU cpp.
  101.   2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that
  102.      file name.
  103.   3. Undo your change in `cccp.c', or reinstall the original version,
  104.      and do `make cpp' again.
  105.   4. Copy this final version of GNU cpp into `/lib/cpp'.
  106.   5. Replace every occurrence of `obstack_free' in the file `tree.c'
  107.      with `_obstack_free'.
  108.   6. Run `make' to get the first-stage GNU CC.
  109.   7. Reinstall the original version of `/lib/cpp'.
  110.   8. Now you can compile GNU CC with itself and install it in the normal
  111.      fashion.
  112. File: gcc.info,  Node: Unos Install,  Next: VMS Install,  Prev: 3b1 Install,  Up: Installation
  113. Installing GNU CC on Unos
  114. =========================
  115.    Use `configure unos' for building on Unos.
  116.    The Unos assembler is named `casm' instead of `as'.  For some
  117. strange reason linking `/bin/as' to `/bin/casm' changes the behavior,
  118. and does not work.  So, when installing GNU CC, you should install the
  119. following script as `as' in the subdirectory where the passes of GCC
  120. are installed:
  121.      #!/bin/sh
  122.      casm $*
  123.    The default Unos library is named `libunos.a' instead of `libc.a'.
  124. To allow GNU CC to function, either change all references to `-lc' in
  125. `gcc.c' to `-lunos' or link `/lib/libc.a' to `/lib/libunos.a'.
  126.    When compiling GNU CC with the standard compiler, to overcome bugs in
  127. the support of `alloca', do not use `-O' when making stage 2.  Then use
  128. the stage 2 compiler with `-O' to make the stage 3 compiler.  This
  129. compiler will have the same characteristics as the usual stage 2
  130. compiler on other systems.  Use it to make a stage 4 compiler and
  131. compare that with stage 3 to verify proper compilation.
  132.    (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  133. comments there will make the above paragraph superfluous.  Please
  134. inform us of whether this works.)
  135.    Unos uses memory segmentation instead of demand paging, so you will
  136. need a lot of memory.  5 Mb is barely enough if no other tasks are
  137. running.  If linking `cc1' fails, try putting the object files into a
  138. library and linking from that library.
  139. File: gcc.info,  Node: VMS Install,  Next: WE32K Install,  Prev: Unos Install,  Up: Installation
  140. Installing GNU CC on VMS
  141. ========================
  142.    The VMS version of GNU CC is distributed in a backup saveset
  143. containing both source code and precompiled binaries.
  144.    To install the `gcc' command so you can use the compiler easily, in
  145. the same manner as you use the VMS C compiler, you must install the VMS
  146. CLD file for GNU CC as follows:
  147.   1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
  148.      point to the directories where the GNU CC executables
  149.      (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
  150.      kept respectively.  This should be done with the commands:
  151.           $ assign /system /translation=concealed -
  152.             disk:[gcc.] gnu_cc
  153.           $ assign /system /translation=concealed -
  154.             disk:[gcc.include.] gnu_cc_include
  155.      with the appropriate disk and directory names.  These commands can
  156.      be placed in your system startup file so they will be executed
  157.      whenever the machine is rebooted.  You may, if you choose, do this
  158.      via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  159.   2. Install the `GCC' command with the command line:
  160.           $ set command /table=sys$common:[syslib]dcltables -
  161.             /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
  162.           $ install replace sys$common:[syslib]dcltables
  163.   3. To install the help file, do the following:
  164.           $ library/help sys$library:helplib.hlb gcc.hlp
  165.      Now you can invoke the compiler with a command like `gcc /verbose
  166.      file.c', which is equivalent to the command `gcc -v -c file.c' in
  167.      Unix.
  168.    If you wish to use GNU C++ you must first install GNU CC, and then
  169. perform the following steps:
  170.   1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
  171.      directory where the preprocessor will search for the C++ header
  172.      files.  This can be done with the command:
  173.           $ assign /system /translation=concealed -
  174.             disk:[gcc.gxx_include.] gnu_gxx_include
  175.      with the appropriate disk and directory name.  If you are going to
  176.      be using libg++, this is where the libg++ install procedure will
  177.      install the libg++ header files.
  178.   2. Obtain the file `gcc-cc1plus.exe', and place this in the same
  179.      directory that `gcc-cc1.exe' is kept.
  180.      The GNU C++ compiler can be invoked with a command like `gcc /plus
  181.      /verbose file.cc', which is equivalent to the command `g++ -v -c
  182.      file.cc' in Unix.
  183.    We try to put corresponding binaries and sources on the VMS
  184. distribution tape.  But sometimes the binaries will be from an older
  185. version than the sources, because we don't always have time to update
  186. them.  (Use the `/version' option to determine the version number of
  187. the binaries and compare it with the source file `version.c' to tell
  188. whether this is so.)  In this case, you should use the binaries you get
  189. to recompile the sources.  If you must recompile, here is how:
  190.   1. Execute the command procedure `vmsconfig.com' to set up the files
  191.      `tm.h', `config.h', `aux-output.c', and `md.', and to create files
  192.      `tconfig.h' and `hconfig.h'.  This procedure also creates several
  193.      linker option files used by `make-cc1.com' and a data file used by
  194.      `make-l2.com'.
  195.           $ @vmsconfig.com
  196.   2. Setup the logical names and command tables as defined above.  In
  197.      addition, define the VMS logical name `GNU_BISON' to point at the
  198.      to the directories where the Bison executable is kept.  This
  199.      should be done with the command:
  200.           $ assign /system /translation=concealed -
  201.             disk:[bison.] gnu_bison
  202.      You may, if you choose, use the `INSTALL_BISON.COM' script in the
  203.      `[BISON]' directory.
  204.   3. Install the `BISON' command with the command line:
  205.           $ set command /table=sys$common:[syslib]dcltables -
  206.             /output=sys$common:[syslib]dcltables -
  207.             gnu_bison:[000000]bison
  208.           $ install replace sys$common:[syslib]dcltables
  209.   4. Type `@make-gcc' to recompile everything (alternatively, submit
  210.      the file `make-gcc.com' to a batch queue).  If you wish to build
  211.      the GNU C++ compiler as well as the GNU CC compiler, you must
  212.      first edit `make-gcc.com' and follow the instructions that appear
  213.      in the comments.
  214.   5. In order to use GCC, you need a library of functions which GCC
  215.      compiled code will call to perform certain tasks, and these
  216.      functions are defined in the file `libgcc2.c'.  To compile this
  217.      you should use the command procedure `make-l2.com', which will
  218.      generate the library `libgcc2.olb'.  `libgcc2.olb' should be built
  219.      using the compiler built from the same distribution that
  220.      `libgcc2.c' came from, and `make-gcc.com' will automatically do
  221.      all of this for you.
  222.      To install the library, use the following commands:
  223.           $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
  224.           $ library gnu_cc:[000000]gcclib/delete=L_*
  225.           $ library libgcc2/extract=*/output=libgcc2.obj
  226.           $ library gnu_cc:[000000]gcclib libgcc2.obj
  227.      The first command simply removes old modules that will be replaced
  228.      with modules from `libgcc2' under different module names.  The
  229.      modules `new' and `eprintf' may not actually be present in your
  230.      `gcclib.olb'--if the VMS librarian complains about those modules
  231.      not being present, simply ignore the message and continue on with
  232.      the next command.  The second command removes the modules that
  233.      came from the previous version of the library `libgcc2.c'.
  234.      Whenever you update the compiler on your system, you should also
  235.      update the library with the above procedure.
  236.   6. You may wish to build GCC in such a way that no files are written
  237.      to the directory where the source files reside.  An example would
  238.      be the when the source files are on a read-only disk.  In these
  239.      cases, execute the following DCL commands (substituting your
  240.      actual path names):
  241.           $ assign dua0:[gcc.build_dir.]/translation=concealed, -
  242.                    dua1:[gcc.source_dir.]/translation=concealed  gcc_build
  243.           $ set default gcc_build:[000000]
  244.      where the directory `dua1:[gcc.source_dir]' contains the source
  245.      code, and the directory `dua0:[gcc.build_dir]' is meant to contain
  246.      all of the generated object files and executables.  Once you have
  247.      done this, you can proceed building GCC as described above.  (Keep
  248.      in mind that `gcc_build' is a rooted logical name, and thus the
  249.      device names in each element of the search list must be an actual
  250.      physical device name rather than another rooted logical name).
  251.   7. *If you are building GNU CC with a previous version of GNU CC, you
  252.      also should check to see that you have the newest version of the
  253.      assembler*.  In particular, GNU CC version 2 treats global constant
  254.      variables slightly differently from GNU CC version 1, and GAS
  255.      version 1.38.1 does not have the patches required to work with GCC
  256.      version 2.  If you use GAS 1.38.1, then `extern const' variables
  257.      will not have the read-only bit set, and the linker will generate
  258.      warning messages about mismatched psect attributes for these
  259.      variables.  These warning messages are merely a nuisance, and can
  260.      safely be ignored.
  261.      If you are compiling with a version of GNU CC older than 1.33,
  262.      specify `/DEFINE=("inline=")' as an option in all the
  263.      compilations.  This requires editing all the `gcc' commands in
  264.      `make-cc1.com'.  (The older versions had problems supporting
  265.      `inline'.)  Once you have a working 1.33 or newer GNU CC, you can
  266.      change this file back.
  267.   8. If you want to build GNU CC with the VAX C compiler, you will need
  268.      to make minor changes in `make-cccp.com' and `make-cc1.com' to
  269.      choose alternate definitions of `CC', `CFLAGS', and `LIBS'.  See
  270.      comments in those files.  However, you must also have a working
  271.      version of the GNU assembler (GNU as, aka GAS) as it is used as
  272.      the back-end for GNU CC to produce binary object modules and is
  273.      not included in the GNU CC sources.  GAS is also needed to compile
  274.      `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
  275.      expects to be able to find it operational in
  276.      `gnu_cc:[000000]gnu-as.exe'.
  277.      To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
  278.      `gcc.com', and `gcc.cld'.  They are distributed with the VMS
  279.      binaries (`gcc-vms') rather than the GNU CC sources.  GAS is also
  280.      included in `gcc-vms', as is Bison.
  281.      Once you have successfully built GNU CC with VAX C, you should use
  282.      the resulting compiler to rebuild itself.  Before doing this, be
  283.      sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
  284.      `make-cccp.com' and `make-cc1.com'.  The second generation
  285.      compiler will be able to take advantage of many optimizations that
  286.      must be suppressed when building with other compilers.
  287.    Under previous versions of GNU CC, the generated code would
  288. occasionally give strange results when linked with the sharable
  289. `VAXCRTL' library.  Now this should work.
  290.    Even with this version, however, GNU CC itself should not be linked
  291. with the sharable `VAXCRTL'.  The version of `qsort' in `VAXCRTL' has a
  292. bug (known to be present in VMS versions V4.6 through V5.5) which
  293. causes the compiler to fail.
  294.    The executables are generated by `make-cc1.com' and `make-cccp.com'
  295. use the object library version of `VAXCRTL' in order to make use of the
  296. `qsort' routine in `gcclib.olb'.  If you wish to link the compiler
  297. executables with the shareable image version of `VAXCRTL', you should
  298. edit the file `tm.h' (created by `vmsconfig.com') to define the macro
  299. `QSORT_WORKAROUND'.
  300.    `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
  301. VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
  302. File: gcc.info,  Node: WE32K Install,  Next: MIPS Install,  Prev: VMS Install,  Up: Installation
  303. Installing GNU CC on the WE32K
  304. ==============================
  305.    These computers are also known as the 3b2, 3b5, 3b20 and other
  306. similar names.  (However, the 3b1 is actually a 68000; see *Note 3b1
  307. Install::.)
  308.    Don't use `-g' when compiling with the system's compiler.  The
  309. system's linker seems to be unable to handle such a large program with
  310. debugging information.
  311.    The system's compiler runs out of capacity when compiling `stmt.c'
  312. in GNU CC.  You can work around this by building `cpp' in GNU CC first,
  313. then use that instead of the system's preprocessor with the system's C
  314. compiler to compile `stmt.c'.  Here is how:
  315.      mv /lib/cpp /lib/cpp.att
  316.      cp cpp /lib/cpp.gnu
  317.      echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
  318.      chmod +x /lib/cpp
  319.    The system's compiler produces bad code for some of the GNU CC
  320. optimization files.  So you must build the stage 2 compiler without
  321. optimization.  Then build a stage 3 compiler with optimization.  That
  322. executable should work.  Here are the necessary commands:
  323.      make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
  324.      make stage2
  325.      make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
  326.    You may need to raise the ULIMIT setting to build a C++ compiler, as
  327. the file `cc1plus' is larger than one megabyte.
  328. File: gcc.info,  Node: MIPS Install,  Next: Collect2,  Prev: WE32K Install,  Up: Installation
  329. Installing GNU CC on the MIPS
  330. =============================
  331.    See *Note Installation:: about whether to use either of the options
  332. `--with-stabs' or `--with-gnu-as'.
  333.    The MIPS C compiler needs to be told to increase its table size for
  334. switch statements with the `-Wf,-XNg1500' option in order to compile
  335. `cp-parse.c'.  If you use the `-O2' optimization option, you also need
  336. to use `-Olimit 3000'.  Both of these options are automatically
  337. generated in the `Makefile' that the shell script `configure' builds.
  338. If you override the `CC' make variable and use the MIPS compilers, you
  339. may need to add `-Wf,-XNg1500 -Olimit 3000'.
  340.    MIPS computers running RISC-OS can support four different
  341. personalities: default, BSD 4.3, System V.3, and System V.4 (older
  342. versions of RISC-OS don't support V.4).  To configure GCC for these
  343. platforms use the following configurations:
  344. `mips-mips-riscos`rev''
  345.      Default configuration for RISC-OS, revision `rev'.
  346. `mips-mips-riscos`rev'bsd'
  347.      BSD 4.3 configuration for RISC-OS, revision `rev'.
  348. `mips-mips-riscos`rev'sysv4'
  349.      System V.4 configuration for RISC-OS, revision `rev'.
  350. `mips-mips-riscos`rev'sysv'
  351.      System V.3 configuration for RISC-OS, revision `rev'.
  352.    The revision `rev' mentioned above is the revision of RISC-OS to
  353. use.  You must reconfigure GCC when going from a RISC-OS revision 4 to
  354. RISC-OS revision 5.  This has the effect of avoiding a linker bug (see
  355. *Note Installation Problems:: for more details).
  356.    DECstations can support three different personalities: Ultrix, DEC
  357. OSF/1, and OSF/rose.  To configure GCC for these platforms use the
  358. following configurations:
  359. `decstation-ultrix'
  360.      Ultrix configuration.
  361. `decstation-osf1'
  362.      Dec's version of OSF/1.
  363. `decstation-osfrose'
  364.      Open Software Foundation reference port of OSF/1 which uses the
  365.      OSF/rose object file format instead of ECOFF.  Normally, you would
  366.      not select this configuration.
  367.    On Irix version 4.0.5F, and perhaps on some other versions as well,
  368. there is an assembler bug that reorders instructions incorrectly.  To
  369. work around it, specify the target configuration `mips-sgi-irix4loser'.
  370. This configuration inhibits assembler optimization.
  371.    You can turn off assembler optimization in a compiler configured with
  372. target `mips-sgi-irix4' using the `-noasmopt' option.  This compiler
  373. option passes the option `-O0' to the assembler, to inhibit reordering.
  374.    The `-noasmopt' option can be useful for testing whether a problem
  375. is due to erroneous assembler reordering.  Even if a problem does not go
  376. away with `-noasmopt', it may still be due to assembler
  377. reordering--perhaps GNU CC itself was miscompiled as a result.
  378.    We know this is inconvenient, but it's the best that can be done at
  379. the last minute.
  380. File: gcc.info,  Node: Collect2,  Next: Header Dirs,  Prev: MIPS Install,  Up: Installation
  381. `collect2'
  382. ==========
  383.    Many target systems do not have support in the assembler and linker
  384. for "constructors"--initialization functions to be called before the
  385. official "start" of `main'.  On such systems, GNU CC uses a utility
  386. called `collect2' to arrange to call these functions at start time.
  387.    The program `collect2' works by linking the program once and looking
  388. through the linker output file for symbols with particular names
  389. indicating they are constructor functions.  If it finds any, it creates
  390. a new temporary `.c' file containing a table of them, compiles it, and
  391. links the program a second time including that file.
  392.    The actual calls to the constructors are carried out by a subroutine
  393. called `__main', which is called (automatically) at the beginning of
  394. the body of `main' (provided `main' was compiled with GNU CC).
  395.    The program `collect2' is installed as `ld' in the directory where
  396. the passes of the compiler are installed.  When `collect2' needs to
  397. find the *real* `ld', it tries the following file names:
  398.    * `gld' in the directories listed in the compiler's search
  399.      directories.
  400.    * `gld' in the directories listed in the environment variable `PATH'.
  401.    * `real-ld' in the compiler's search directories.
  402.    * `real-ld' in `PATH'.
  403.    * `ld' in `PATH'.
  404.    "The compiler's search directories" means all the directories where
  405. `gcc' searches for passes of the compiler.  This includes directories
  406. that you specify with `-B'.
  407.    Cross-compilers search a little differently:
  408.    * `gld' in the compiler's search directories.
  409.    * `TARGET-gld' in `PATH'.
  410.    * `real-ld' in the compiler's search directories.
  411.    * `TARGET-real-ld' in `PATH'.
  412.    * `TARGET-ld' in `PATH'.
  413.    `collect2' does not search for `ld' using the compiler's search
  414. directories, because if it did, it would find itself--not the real
  415. `ld'--and this could lead to infinite recursion.  However, the
  416. directory where `collect2' is installed might happen to be in `PATH'.
  417. That could lead `collect2' to invoke itself anyway.  when looking for
  418. `ld'.
  419.    To prevent this, `collect2' explicitly avoids running `ld' using the
  420. file name under which `collect2' itself was invoked.  In fact, it
  421. remembers up to two such names--in case one copy of `collect2' finds
  422. another copy (or version) of `collect2' installed as `ld' in a second
  423. place in the search path.
  424.    If two file names to avoid are not sufficient, you may still
  425. encounter an infinite recursion of `collect2' processes.  When this
  426. happens.  check all the files installed as `ld' in any of the
  427. directories searched, and straighten out the situation.
  428.    (In a future version, we will probably change `collect2' to avoid
  429. any reinvocation of a file from which any parent `collect2' was run.)
  430. File: gcc.info,  Node: Header Dirs,  Prev: Collect2,  Up: Installation
  431. Standard Header File Directories
  432. ================================
  433.    `GCC_INCLUDE_DIR' means the same thing for native and cross.  It is
  434. where GNU CC stores its private include files, and also where GNU CC
  435. stores the fixed include files.  A cross compiled GNU CC runs
  436. `fixincludes' on the header files in `$(tooldir)/include'.  (If the
  437. cross compilation header files need to be fixed, they must be installed
  438. before GNU CC is built.  If the cross compilation header files are
  439. already suitable for ANSI C and GNU CC, nothing special need be done).
  440.    `GPLUS_INCLUDE_DIR' means the same thing for native and cross.  It
  441. is where `g++' looks first for header files.  `libg++' installs only
  442. target independent header files in that directory.
  443.    `LOCAL_INCLUDE_DIR' is used only for a native compiler.  It is
  444. normally `/usr/local/include'.  GNU CC searches this directory so that
  445. users can install header files in `/usr/local/include'.
  446.    `CROSS_INCLUDE_DIR' is used only for a cross compiler.  GNU CC
  447. doesn't install anything there.
  448.    `TOOL_INCLUDE_DIR' is used for both native and cross compilers.  It
  449. is the place for other packages to install header files that GNU CC will
  450. use.  For a cross-compiler, this is the equivalent of `/usr/include'.
  451. When you build a cross-compiler, `fixincludes' processes any header
  452. files in this directory.
  453. File: gcc.info,  Node: C Extensions,  Next: C++ Extensions,  Prev: Installation,  Up: Top
  454. Extensions to the C Language Family
  455. ***********************************
  456.    GNU C provides several language features not found in ANSI standard
  457. C.  (The `-pedantic' option directs GNU CC to print a warning message if
  458. any of these features is used.)  To test for the availability of these
  459. features in conditional compilation, check for a predefined macro
  460. `__GNUC__', which is always defined under GNU CC.
  461.    These extensions are available in C and in the languages derived from
  462. it, C++ and Objective C.  *Note Extensions to the C++ Language: C++
  463. Extensions, for extensions that apply *only* to C++.
  464. * Menu:
  465. * Statement Exprs::     Putting statements and declarations inside expressions.
  466. * Local Labels::        Labels local to a statement-expression.
  467. * Labels as Values::    Getting pointers to labels, and computed gotos.
  468. * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
  469. * Constructing Calls::    Dispatching a call to another function.
  470. * Naming Types::        Giving a name to the type of some expression.
  471. * Typeof::              `typeof': referring to the type of an expression.
  472. * Lvalues::             Using `?:', `,' and casts in lvalues.
  473. * Conditionals::        Omitting the middle operand of a `?:' expression.
  474. * Long Long::        Double-word integers--`long long int'.
  475. * Complex::             Data types for complex numbers.
  476. * Zero Length::         Zero-length arrays.
  477. * Variable Length::     Arrays whose length is computed at run time.
  478. * Macro Varargs::    Macros with variable number of arguments.
  479. * Subscripting::        Any array can be subscripted, even if not an lvalue.
  480. * Pointer Arith::       Arithmetic on `void'-pointers and function pointers.
  481. * Initializers::        Non-constant initializers.
  482. * Constructors::        Constructor expressions give structures, unions
  483.                          or arrays as values.
  484. * Labeled Elements::    Labeling elements of initializers.
  485. * Cast to Union::       Casting to union type from any member of the union.
  486. * Case Ranges::        `case 1 ... 9' and such.
  487. * Function Attributes:: Declaring that functions have no side effects,
  488.                          or that they can never return.
  489. * Function Prototypes:: Prototype declarations and old-style definitions.
  490. * Dollar Signs::        Dollar sign is allowed in identifiers.
  491. * Character Escapes::   `\e' stands for the character ESC.
  492. * Variable Attributes::    Specifying attributes of variables.
  493. * Alignment::           Inquiring about the alignment of a type or variable.
  494. * Inline::              Defining inline functions (as fast as macros).
  495. * Extended Asm::        Assembler instructions with C expressions as operands.
  496.                          (With them you can define "built-in" functions.)
  497. * Asm Labels::          Specifying the assembler name to use for a C symbol.
  498. * Explicit Reg Vars::   Defining variables residing in specified registers.
  499. * Alternate Keywords::  `__const__', `__asm__', etc., for header files.
  500. * Incomplete Enums::    `enum foo;', with details to follow.
  501. * Function Names::    Printable strings which are the name of the current
  502.              function.
  503. File: gcc.info,  Node: Statement Exprs,  Next: Local Labels,  Up: C Extensions
  504. Statements and Declarations in Expressions
  505. ==========================================
  506.    A compound statement enclosed in parentheses may appear as an
  507. expression in GNU C.  This allows you to use loops, switches, and local
  508. variables within an expression.
  509.    Recall that a compound statement is a sequence of statements
  510. surrounded by braces; in this construct, parentheses go around the
  511. braces.  For example:
  512.      ({ int y = foo (); int z;
  513.         if (y > 0) z = y;
  514.         else z = - y;
  515.         z; })
  516. is a valid (though slightly more complex than necessary) expression for
  517. the absolute value of `foo ()'.
  518.    The last thing in the compound statement should be an expression
  519. followed by a semicolon; the value of this subexpression serves as the
  520. value of the entire construct.  (If you use some other kind of statement
  521. last within the braces, the construct has type `void', and thus
  522. effectively no value.)
  523.    This feature is especially useful in making macro definitions "safe"
  524. (so that they evaluate each operand exactly once).  For example, the
  525. "maximum" function is commonly defined as a macro in standard C as
  526. follows:
  527.      #define max(a,b) ((a) > (b) ? (a) : (b))
  528. But this definition computes either A or B twice, with bad results if
  529. the operand has side effects.  In GNU C, if you know the type of the
  530. operands (here let's assume `int'), you can define the macro safely as
  531. follows:
  532.      #define maxint(a,b) \
  533.        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  534.    Embedded statements are not allowed in constant expressions, such as
  535. the value of an enumeration constant, the width of a bit field, or the
  536. initial value of a static variable.
  537.    If you don't know the type of the operand, you can still do this,
  538. but you must use `typeof' (*note Typeof::.) or type naming (*note
  539. Naming Types::.).
  540. File: gcc.info,  Node: Local Labels,  Next: Labels as Values,  Prev: Statement Exprs,  Up: C Extensions
  541. Locally Declared Labels
  542. =======================
  543.    Each statement expression is a scope in which "local labels" can be
  544. declared.  A local label is simply an identifier; you can jump to it
  545. with an ordinary `goto' statement, but only from within the statement
  546. expression it belongs to.
  547.    A local label declaration looks like this:
  548.      __label__ LABEL;
  549.      __label__ LABEL1, LABEL2, ...;
  550.    Local label declarations must come at the beginning of the statement
  551. expression, right after the `({', before any ordinary declarations.
  552.    The label declaration defines the label *name*, but does not define
  553. the label itself.  You must do this in the usual way, with `LABEL:',
  554. within the statements of the statement expression.
  555.    The local label feature is useful because statement expressions are
  556. often used in macros.  If the macro contains nested loops, a `goto' can
  557. be useful for breaking out of them.  However, an ordinary label whose
  558. scope is the whole function cannot be used: if the macro can be
  559. expanded several times in one function, the label will be multiply
  560. defined in that function.  A local label avoids this problem.  For
  561. example:
  562.      #define SEARCH(array, target)                     \
  563.      ({                                               \
  564.        __label__ found;                                \
  565.        typeof (target) _SEARCH_target = (target);      \
  566.        typeof (*(array)) *_SEARCH_array = (array);     \
  567.        int i, j;                                       \
  568.        int value;                                      \
  569.        for (i = 0; i < max; i++)                       \
  570.          for (j = 0; j < max; j++)                     \
  571.            if (_SEARCH_array[i][j] == _SEARCH_target)  \
  572.              { value = i; goto found; }              \
  573.        value = -1;                                     \
  574.       found:                                           \
  575.        value;                                          \
  576.      })
  577. File: gcc.info,  Node: Labels as Values,  Next: Nested Functions,  Prev: Local Labels,  Up: C Extensions
  578. Labels as Values
  579. ================
  580.    You can get the address of a label defined in the current function
  581. (or a containing function) with the unary operator `&&'.  The value has
  582. type `void *'.  This value is a constant and can be used wherever a
  583. constant of that type is valid.  For example:
  584.      void *ptr;
  585.      ...
  586.      ptr = &&foo;
  587.    To use these values, you need to be able to jump to one.  This is
  588. done with the computed goto statement(1), `goto *EXP;'.  For example,
  589.      goto *ptr;
  590. Any expression of type `void *' is allowed.
  591.    One way of using these constants is in initializing a static array
  592. that will serve as a jump table:
  593.      static void *array[] = { &&foo, &&bar, &&hack };
  594.    Then you can select a label with indexing, like this:
  595.      goto *array[i];
  596. Note that this does not check whether the subscript is in bounds--array
  597. indexing in C never does that.
  598.    Such an array of label values serves a purpose much like that of the
  599. `switch' statement.  The `switch' statement is cleaner, so use that
  600. rather than an array unless the problem does not fit a `switch'
  601. statement very well.
  602.    Another use of label values is in an interpreter for threaded code.
  603. The labels within the interpreter function can be stored in the
  604. threaded code for super-fast dispatching.
  605.    You can use this mechanism to jump to code in a different function.
  606. If you do that, totally unpredictable things will happen.  The best way
  607. to avoid this is to store the label address only in automatic variables
  608. and never pass it as an argument.
  609.    ---------- Footnotes ----------
  610.    (1)  The analogous feature in Fortran is called an assigned goto,
  611. but that name seems inappropriate in C, where one can do more than
  612. simply store label addresses in label variables.
  613. File: gcc.info,  Node: Nested Functions,  Next: Constructing Calls,  Prev: Labels as Values,  Up: C Extensions
  614. Nested Functions
  615. ================
  616.    A "nested function" is a function defined inside another function.
  617. (Nested functions are not supported for GNU C++.)  The nested function's
  618. name is local to the block where it is defined.  For example, here we
  619. define a nested function named `square', and call it twice:
  620.      foo (double a, double b)
  621.      {
  622.        double square (double z) { return z * z; }
  623.      
  624.        return square (a) + square (b);
  625.      }
  626.    The nested function can access all the variables of the containing
  627. function that are visible at the point of its definition.  This is
  628. called "lexical scoping".  For example, here we show a nested function
  629. which uses an inherited variable named `offset':
  630.      bar (int *array, int offset, int size)
  631.      {
  632.        int access (int *array, int index)
  633.          { return array[index + offset]; }
  634.        int i;
  635.        ...
  636.        for (i = 0; i < size; i++)
  637.          ... access (array, i) ...
  638.      }
  639.    Nested function definitions are permitted within functions in the
  640. places where variable definitions are allowed; that is, in any block,
  641. before the first statement in the block.
  642.    It is possible to call the nested function from outside the scope of
  643. its name by storing its address or passing the address to another
  644. function:
  645.      hack (int *array, int size)
  646.      {
  647.        void store (int index, int value)
  648.          { array[index] = value; }
  649.      
  650.        intermediate (store, size);
  651.      }
  652.    Here, the function `intermediate' receives the address of `store' as
  653. an argument.  If `intermediate' calls `store', the arguments given to
  654. `store' are used to store into `array'.  But this technique works only
  655. so long as the containing function (`hack', in this example) does not
  656. exit.  If you try to call the nested function through its address after
  657. the containing function has exited, all hell will break loose.
  658.    GNU CC implements taking the address of a nested function using a
  659. technique called "trampolines".  A paper describing them is available
  660. from `maya.idiap.ch' in directory `pub/tmb', file `usenix88-lexic.ps.Z'.
  661.    A nested function can jump to a label inherited from a containing
  662. function, provided the label was explicitly declared in the containing
  663. function (*note Local Labels::.).  Such a jump returns instantly to the
  664. containing function, exiting the nested function which did the `goto'
  665. and any intermediate functions as well.  Here is an example:
  666.      bar (int *array, int offset, int size)
  667.      {
  668.        __label__ failure;
  669.        int access (int *array, int index)
  670.          {
  671.            if (index > size)
  672.              goto failure;
  673.            return array[index + offset];
  674.          }
  675.        int i;
  676.        ...
  677.        for (i = 0; i < size; i++)
  678.          ... access (array, i) ...
  679.        ...
  680.        return 0;
  681.      
  682.       /* Control comes here from `access'
  683.          if it detects an error.  */
  684.       failure:
  685.        return -1;
  686.      }
  687.    A nested function always has internal linkage.  Declaring one with
  688. `extern' is erroneous.  If you need to declare the nested function
  689. before its definition, use `auto' (which is otherwise meaningless for
  690. function declarations).
  691.      bar (int *array, int offset, int size)
  692.      {
  693.        __label__ failure;
  694.        auto int access (int *, int);
  695.        ...
  696.        int access (int *array, int index)
  697.          {
  698.            if (index > size)
  699.              goto failure;
  700.            return array[index + offset];
  701.          }
  702.        ...
  703.      }
  704. File: gcc.info,  Node: Constructing Calls,  Next: Naming Types,  Prev: Nested Functions,  Up: C Extensions
  705. Constructing Function Calls
  706. ===========================
  707.    Using the built-in functions described below, you can record the
  708. arguments a function received, and call another function with the same
  709. arguments, without knowing the number or types of the arguments.
  710.    You can also record the return value of that function call, and
  711. later return that value, without knowing what data type the function
  712. tried to return (as long as your caller expects that data type).
  713. `__builtin_apply_args ()'
  714.      This built-in function returns a pointer of type `void *' to data
  715.      describing how to perform a call with the same arguments as were
  716.      passed to the current function.
  717.      The function saves the arg pointer register, structure value
  718.      address, and all registers that might be used to pass arguments to
  719.      a function into a block of memory allocated on the stack.  Then it
  720.      returns the address of that block.
  721. `__builtin_apply (FUNCTION, ARGUMENTS, SIZE)'
  722.      This built-in function invokes FUNCTION (type `void (*)()') with a
  723.      copy of the parameters described by ARGUMENTS (type `void *') and
  724.      SIZE (type `int').
  725.      The value of ARGUMENTS should be the value returned by
  726.      `__builtin_apply_args'.  The argument SIZE specifies the size of
  727.      the stack argument data, in bytes.
  728.      This function returns a pointer of type `void *' to data describing
  729.      how to return whatever value was returned by FUNCTION.  The data
  730.      is saved in a block of memory allocated on the stack.
  731.      It is not always simple to compute the proper value for SIZE.  The
  732.      value is used by `__builtin_apply' to compute the amount of data
  733.      that should be pushed on the stack and copied from the incoming
  734.      argument area.
  735. `__builtin_return (RESULT)'
  736.      This built-in function returns the value described by RESULT from
  737.      the containing function.  You should specify, for RESULT, a value
  738.      returned by `__builtin_apply'.
  739. File: gcc.info,  Node: Naming Types,  Next: Typeof,  Prev: Constructing Calls,  Up: C Extensions
  740. Naming an Expression's Type
  741. ===========================
  742.    You can give a name to the type of an expression using a `typedef'
  743. declaration with an initializer.  Here is how to define NAME as a type
  744. name for the type of EXP:
  745.      typedef NAME = EXP;
  746.    This is useful in conjunction with the statements-within-expressions
  747. feature.  Here is how the two together can be used to define a safe
  748. "maximum" macro that operates on any arithmetic type:
  749.      #define max(a,b) \
  750.        ({typedef _ta = (a), _tb = (b);  \
  751.          _ta _a = (a); _tb _b = (b);     \
  752.          _a > _b ? _a : _b; })
  753.    The reason for using names that start with underscores for the local
  754. variables is to avoid conflicts with variable names that occur within
  755. the expressions that are substituted for `a' and `b'.  Eventually we
  756. hope to design a new form of declaration syntax that allows you to
  757. declare variables whose scopes start only after their initializers;
  758. this will be a more reliable way to prevent such conflicts.
  759. File: gcc.info,  Node: Typeof,  Next: Lvalues,  Prev: Naming Types,  Up: C Extensions
  760. Referring to a Type with `typeof'
  761. =================================
  762.    Another way to refer to the type of an expression is with `typeof'.
  763. The syntax of using of this keyword looks like `sizeof', but the
  764. construct acts semantically like a type name defined with `typedef'.
  765.    There are two ways of writing the argument to `typeof': with an
  766. expression or with a type.  Here is an example with an expression:
  767.      typeof (x[0](1))
  768. This assumes that `x' is an array of functions; the type described is
  769. that of the values of the functions.
  770.    Here is an example with a typename as the argument:
  771.      typeof (int *)
  772. Here the type described is that of pointers to `int'.
  773.    If you are writing a header file that must work when included in
  774. ANSI C programs, write `__typeof__' instead of `typeof'.  *Note
  775. Alternate Keywords::.
  776.    A `typeof'-construct can be used anywhere a typedef name could be
  777. used.  For example, you can use it in a declaration, in a cast, or
  778. inside of `sizeof' or `typeof'.
  779.    * This declares `y' with the type of what `x' points to.
  780.           typeof (*x) y;
  781.    * This declares `y' as an array of such values.
  782.           typeof (*x) y[4];
  783.    * This declares `y' as an array of pointers to characters:
  784.           typeof (typeof (char *)[4]) y;
  785.      It is equivalent to the following traditional C declaration:
  786.           char *y[4];
  787.      To see the meaning of the declaration using `typeof', and why it
  788.      might be a useful way to write, let's rewrite it with these macros:
  789.           #define pointer(T)  typeof(T *)
  790.           #define array(T, N) typeof(T [N])
  791.      Now the declaration can be rewritten this way:
  792.           array (pointer (char), 4) y;
  793.      Thus, `array (pointer (char), 4)' is the type of arrays of 4
  794.      pointers to `char'.
  795. File: gcc.info,  Node: Lvalues,  Next: Conditionals,  Prev: Typeof,  Up: C Extensions
  796. Generalized Lvalues
  797. ===================
  798.    Compound expressions, conditional expressions and casts are allowed
  799. as lvalues provided their operands are lvalues.  This means that you
  800. can take their addresses or store values into them.
  801.    For example, a compound expression can be assigned, provided the last
  802. expression in the sequence is an lvalue.  These two expressions are
  803. equivalent:
  804.      (a, b) += 5
  805.      a, (b += 5)
  806.    Similarly, the address of the compound expression can be taken.
  807. These two expressions are equivalent:
  808.      &(a, b)
  809.      a, &b
  810.    A conditional expression is a valid lvalue if its type is not void
  811. and the true and false branches are both valid lvalues.  For example,
  812. these two expressions are equivalent:
  813.      (a ? b : c) = 5
  814.      (a ? b = 5 : (c = 5))
  815.    A cast is a valid lvalue if its operand is an lvalue.  A simple
  816. assignment whose left-hand side is a cast works by converting the
  817. right-hand side first to the specified type, then to the type of the
  818. inner left-hand side expression.  After this is stored, the value is
  819. converted back to the specified type to become the value of the
  820. assignment.  Thus, if `a' has type `char *', the following two
  821. expressions are equivalent:
  822.      (int)a = 5
  823.      (int)(a = (char *)(int)5)
  824.    An assignment-with-arithmetic operation such as `+=' applied to a
  825. cast performs the arithmetic using the type resulting from the cast,
  826. and then continues as in the previous case.  Therefore, these two
  827. expressions are equivalent:
  828.      (int)a += 5
  829.      (int)(a = (char *)(int) ((int)a + 5))
  830.    You cannot take the address of an lvalue cast, because the use of its
  831. address would not work out coherently.  Suppose that `&(int)f' were
  832. permitted, where `f' has type `float'.  Then the following statement
  833. would try to store an integer bit-pattern where a floating point number
  834. belongs:
  835.      *&(int)f = 1;
  836.    This is quite different from what `(int)f = 1' would do--that would
  837. convert 1 to floating point and store it.  Rather than cause this
  838. inconsistency, we think it is better to prohibit use of `&' on a cast.
  839.    If you really do want an `int *' pointer with the address of `f',
  840. you can simply write `(int *)&f'.
  841. File: gcc.info,  Node: Conditionals,  Next: Long Long,  Prev: Lvalues,  Up: C Extensions
  842. Conditionals with Omitted Operands
  843. ==================================
  844.    The middle operand in a conditional expression may be omitted.  Then
  845. if the first operand is nonzero, its value is the value of the
  846. conditional expression.
  847.    Therefore, the expression
  848.      x ? : y
  849. has the value of `x' if that is nonzero; otherwise, the value of `y'.
  850.    This example is perfectly equivalent to
  851.      x ? x : y
  852. In this simple case, the ability to omit the middle operand is not
  853. especially useful.  When it becomes useful is when the first operand
  854. does, or may (if it is a macro argument), contain a side effect.  Then
  855. repeating the operand in the middle would perform the side effect
  856. twice.  Omitting the middle operand uses the value already computed
  857. without the undesirable effects of recomputing it.
  858. File: gcc.info,  Node: Long Long,  Next: Complex,  Prev: Conditionals,  Up: C Extensions
  859. Double-Word Integers
  860. ====================
  861.    GNU C supports data types for integers that are twice as long as
  862. `long int'.  Simply write `long long int' for a signed integer, or
  863. `unsigned long long int' for an unsigned integer.  To make an integer
  864. constant of type `long long int', add the suffix `LL' to the integer.
  865. To make an integer constant of type `unsigned long long int', add the
  866. suffix `ULL' to the integer.
  867.    You can use these types in arithmetic like any other integer types.
  868. Addition, subtraction, and bitwise boolean operations on these types
  869. are open-coded on all types of machines.  Multiplication is open-coded
  870. if the machine supports fullword-to-doubleword a widening multiply
  871. instruction.  Division and shifts are open-coded only on machines that
  872. provide special support.  The operations that are not open-coded use
  873. special library routines that come with GNU CC.
  874.    There may be pitfalls when you use `long long' types for function
  875. arguments, unless you declare function prototypes.  If a function
  876. expects type `int' for its argument, and you pass a value of type `long
  877. long int', confusion will result because the caller and the subroutine
  878. will disagree about the number of bytes for the argument.  Likewise, if
  879. the function expects `long long int' and you pass `int'.  The best way
  880. to avoid such problems is to use prototypes.
  881. File: gcc.info,  Node: Complex,  Next: Zero Length,  Prev: Long Long,  Up: C Extensions
  882. Complex Numbers
  883. ===============
  884.    GNU C supports complex data types.  You can declare both complex
  885. integer types and complex floating types, using the keyword
  886. `__complex__'.
  887.    For example, `__complex__ double x;' declares `x' as a variable
  888. whose real part and imaginary part are both of type `double'.
  889. `__complex__ short int y;' declares `y' to have real and imaginary
  890. parts of type `short int'; this is not likely to be useful, but it
  891. shows that the set of complex types is complete.
  892.    To write a constant with a complex data type, use the suffix `i' or
  893. `j' (either one; they are equivalent).  For example, `2.5fi' has type
  894. `__complex__ float' and `3i' has type `__complex__ int'.  Such a
  895. constant always has a pure imaginary value, but you can form any
  896. complex value you like by adding one to a real constant.
  897.    To extract the real part of a complex-valued expression EXP, write
  898. `__real__ EXP'.  Likewise, use `__imag__' to extract the imaginary part.
  899.    The operator `~' performs complex conjugation when used on a value
  900. with a complex type.
  901.    GNU CC can allocate complex automatic variables in a noncontiguous
  902. fashion; it's even possible for the real part to be in a register while
  903. the imaginary part is on the stack (or vice-versa).  None of the
  904. supported debugging info formats has a way to represent noncontiguous
  905. allocation like this, so GNU CC describes a noncontiguous complex
  906. variable as if it were two separate variables of noncomplex type.  If
  907. the variable's actual name is `foo', the two fictitious variables are
  908. named `foo$real' and `foo$imag'.  You can examine and set these two
  909. fictitious variables with your debugger.
  910.    A future version of GDB will know how to recognize such pairs and
  911. treat them as a single variable with a complex type.
  912. File: gcc.info,  Node: Zero Length,  Next: Variable Length,  Prev: Complex,  Up: C Extensions
  913. Arrays of Length Zero
  914. =====================
  915.    Zero-length arrays are allowed in GNU C.  They are very useful as
  916. the last element of a structure which is really a header for a
  917. variable-length object:
  918.      struct line {
  919.        int length;
  920.        char contents[0];
  921.      };
  922.      
  923.      {
  924.        struct line *thisline = (struct line *)
  925.          malloc (sizeof (struct line) + this_length);
  926.        thisline->length = this_length;
  927.      }
  928.    In standard C, you would have to give `contents' a length of 1, which
  929. means either you waste space or complicate the argument to `malloc'.
  930.